<div class="myRightType" id="change">
	<div class="title" ng-init="shop.list=1">
		<a href="#/follow/list">大牛订单</a><span>></span>
		<a href="#/follow/more">大牛详情</a>
	</div>
	<ul class="layui-clear getLi">
		<li ng-class="{active:shop.list==1}" ng-click="changeShopList(1)">当前持仓</li>
		<li ng-class="{active:shop.list==2}" ng-click="changeShopList(2)">历史订单</li>
		<li ng-class="{active:shop.list==3}" ng-click="changeShopList(3)">大牛账户</li>
	</ul>
	<div class="inner clearfix" id="inner">
		<!--当前持仓-->
		<div style="margin: 32px;" ng-show="shop.list==1">
			<table id="myChiList">

			</table>
		</div>
		<div style="margin: 32px;" ng-show="shop.list==2">
			<table id="myChiHistory">

			</table>
		</div>
		<!--个人信息-->
		<div id="infoMore" ng-show="shop.list==3" class="clearfix">
			<div class="box layui-clear">
				<div class="layui-row">
					<div class="layui-col-md2">

						<img src="" ng-src="{{shopMoreInfo.icon || 'img/timg.png'}}" id="txImg" />
						<br />
						<p>{{shopMoreInfo.login}}</p>

					</div>
					<div class="layui-col-md4">
						<div>
							<div class="layui-clear">
								<span class="gray">账号</span>
								<span style="border-right: none;">{{shopMoreInfo.login || "/"}}</span>
								<span class="gray">初始入金</span>
								<span>{{shopMoreInfo.initBalance || 0 |number:2 }}</span>

								<span class="gray" style="border-top: none;">累计入金 </span>
								<span style="border-top: none;border-right: none;">{{shopMoreInfo.balance  || 0 |number:2 }}</span>

								<span class="gray" style="border-top: none;">累计出金</span>
								<span style="border-top: none;">{{shopMoreInfo.withdrawal || 0  |number:2  }}</span>
								<span class="gray" style="border-top: none;">累计盈利</span>
								<span style="border-top: none;border-right: none;">{{shopMoreInfo.profit  || 0   |number:2  }}</span>

								<span class="gray" style="border-top: none;">当前余额</span>
								<span style="border-top: none;">{{shopMoreInfo.currentBalance  || 0  |number:2 }}</span>
								<span class="gray" style="border-top: none;">信用额度</span>
								<span style="border-top: none;border-right: none;">{{shopMoreInfo.credit || 0  |number:2 }}</span>

								<span class="gray" style="border-top: none;">交易时长</span>
								<span style="border-top: none;">{{(shopMoreInfo.createTime || 0) }}天</span>

							</div>
							<!--跟单要求-->
							<div class="demand">
								<p class="blue">资金要求：</p>
								<p>跟单账户仓位过小可能会遗漏分配单量低于0.01手的订单，跟单客户建议随时查看仓位状况，保持一个合理仓位水平。 微信端所显示的仓位及净值状况为您本次登录时间同步结果，可能会与实际状况有少许误差，详情请登录客户端或CRM客户关系管理系统查看。
								</p>
								<p class="blue">跟单规则：</p>
								<p>客户账号通过审核后，可自由选择一个或多个信号源跟单，跟随多个信号源时，总资金为100%，即当拿出20%资金跟随信号源A，则跟随其他信号源的资金总量最多为80%。当信号源下单后，客户立即接收到跟单指令，实际跟单价格由于网络延迟、滑点等原因可能与信号源有细微差别。</p>
								<p class="blue">跟单提示：</p>
								<p>您可以只跟随一个信号源，也可以同时跟随多个信号源，信号源由您自主选择，交易有风险，投资须谨慎。</p>

								<button class="gen" ng-click="changeSet(0,shopMoreAll.mtLogin)" ng-if="shopMoreAll.relation==0">更改交易设置</button>
								<button class="change" ng-click="changeSet(1,shopMoreAll.mtLogin)" ng-if="shopMoreAll.relation==1" ng-disabled="dontGen">跟单交易 </button>
							</div>

						</div>
					</div>
					<div class="layui-col-md6">
						<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
							<ul class="layui-tab-title" ng-init="dataNum=1">
								<li ng-class="{layui_this:dataNum==1}" ng-click="dataNum=1">余额监控</li>
								<li ng-class="{layui_this:dataNum==2}" ng-click="dataNum=2">历史跟单金额监控</li>
								<li ng-class="{layui_this:dataNum==3}" ng-click="dataNum=3">盈亏监控</li>
							</ul>
							<div class="layui-tab-content" style="width: 100%;">
								<div class="layui-tab-item layui-show" style="width: 100%;">
									<div id="main" style="width:600px;height:500px;margin: 0 auto;" ng-show="dataNum==1"></div>
								</div>
								<div class="layui-tab-item layui-show">
									<div id="main3" style="width:600px;height:500px;margin: 0 auto;" ng-show="dataNum==2"></div>

								</div>
								<div class="layui-tab-item layui-show">
									<div id="main2" style="width:600px;height:500px;margin: 0 auto;" ng-show="dataNum==3"></div>
									<div id="year">
										<div class="layui-row">
											<div class="layui-col-md3">
												{{yearArr[3]}}
											</div>
											<div class="layui-col-md3">
												{{yearArr[2]}}
											</div>
											<div class="layui-col-md3">
												{{yearArr[1]}}
											</div>
											<div class="layui-col-md3">
												{{yearArr[0]}}
											</div>
										</div>
										<!--<span style="right: 18%;">{{yearArr[3]}}</span>
										<span style="right: 38%;">{{yearArr[2]}}</span>
										<span style="right: 58%;">{{yearArr[1]}}</span>
										<span style="right: -4%;">{{yearArr[0]}}</span>-->
									</div>

								</div>
							</div>
						</div>

					</div>
				</div>

			</div>
		</div>
	</div>

</div>
</div>
<script type="text/javascript">
	layui.use('upload', function() {
		var upload = layui.upload;
		//执行实例
		var uploadInst = upload.render({
			elem: '#changeTx' //绑定元素
				,
			url: '/wechat_mt5/user/upload/icon' //上传接口		
				,
			field: "uploadFile",
			before: function(obj) { //obj参数包含的信息，跟 choose回调完全一致，可参见上文。
				obj.preview(function(index, file, result) {
					$('#txImg').attr('src', result); //图片链接（base64）
				});
			},
			done: function(res) {
				//上传完毕回调
				if(res.code == 0) {
					prompt("修改成功");
				} else {
					prompt("修改失败");
				}

			},
			error: function() {
				prompt("修改失败");
			}
		});
	});

	$('#myChiList').bootstrapTable({
		url: "/wechat_mt5/data/web/more/position",
		method: 'get',
		queryParams: {
			mtLogin: sessionStorage.getItem("moreId")
		},
		columns: [{
			field: 'name',
			title: '名称',
			formatter: txFuction
		}, {
			field: 'order',
			title: '订单编号',

		}, {
			field: 'symbol',
			title: '交易品种',

		}, {
			field: 'cmd',
			title: '类别',
			formatter: type

		}, {
			field: 'volume',
			title: '手数',
			formatter: hand

		}, {
			field: 'openTime',
			title: '开仓时间',
			formatter: date

		}, {
			field: 'openPrice',
			title: '开仓价格',
		}, {
			field: 'sl',
			title: '止损',
		}, {
			field: 'tp',
			title: '止盈',
		}, {
			field: 'point',
			title: '获利点数',
			formatter: ponity
		}, {
			field: 'profit',
			title: '收益金额($)',
			formatter: money

		}],
		height: 650,
		pageSize: 10,
		pageList: [10, 25, 50, 100],
		showRefresh: true,
		editable: true,
		// onClickRow:operateEvents,
		// showColumns: true,
		pagination: true,
		//		  striped: true,
		sidePagination: 'server',

	});
	//余额监控
	var balanceArr = [];
	var balanceDateArr = [];

	$.ajax({
		type: "get",
		url: "/wechat_mt5/monitor/balance",
		data: {
			mtLogin: sessionStorage.getItem("moreId"),
			sort: "time"
		},
		success: function(data) {
			for(x in data.data) {
				var str = date2(data.data[x].time)
				balanceDateArr.push("")
				balanceArr.push({
					name: str,
					value: data.data[x].balance
				})

			}
			//			
			var myChart = echarts.init(document.getElementById('main'));

			function randomData() {
				now = new Date(+now + oneDay);
				value = value + Math.random() * 21 - 10;
				return {
					name: now.toString(),
					value: [
						[now.getFullYear(), now.getMonth() + 1, now.getDate()].join('/'),
						Math.round(value)
					]
				}
			}
			option = {

				tooltip: {
					trigger: 'axis',
					formatter: function(params) {
						params = params[0];
						return params.data.name + "  " + params.data.value
					},
					axisPointer: {
						animation: false
					}
				},
				xAxis: {
					type: 'category',
					data: balanceDateArr,
				},
				yAxis: {
					type: 'value',
					min: function(value) {
						console.log(value)
						return value.min - 100;
					},
					max: function(value) {
						return value.max + 100;
					}
				},
				series: [{
					data: balanceArr,
					type: 'line',
					itemStyle: {
						normal: {
							lineStyle: {
								color: "#6eaaee"
							}
						}
					}

				}]
			};

			//			//			
			myChart.setOption(option);

		}
	});

	//历史跟单金额监控

	var moneyArr = [];
	var moneyDateArr = [];
	$.ajax({
		type: "get",
		url: "/wechat_mt5/monitor/money",
		data: {
			mtLogin: sessionStorage.getItem("moreId"),
			sort: "time"
		},
		success: function(data) {

			for(x in data.data) {
				var str = date2(data.data[x].time)
				moneyDateArr.push("")
				moneyArr.push({
					name: str,
					value: data.data[x].money
				})

			}

			var myChart3 = echarts.init(document.getElementById('main3'));

			var option = {
				tooltip: {
					trigger: 'axis',
					formatter: function(params) {
						params = params[0];
						return params.data.name + "  " + params.data.value
					},
					axisPointer: {
						animation: false
					}
				},
				xAxis: {
					type: 'category',
					data: moneyDateArr,
				},
				yAxis: {
					type: 'value',
					min: function(value) {
						console.log(value)
						return value.min - 100;
					},
					max: function(value) {
						return value.max + 100;
					}
				},
				series: [{
					data: moneyArr,
					type: 'line',
					itemStyle: {
						normal: {
							lineStyle: {
								color: "#6eaaee"
							}
						}
					}

				}]
			};

			//			//			
			myChart3.setOption(option);

		}
	});
	//盈亏监控监控
	var profitArr = [];
	var profitDateArr = [];
	$.ajax({
		type: "get",
		url: "/wechat_mt5/monitor/profit",
		data: {
			mtLogin: sessionStorage.getItem("moreId"),
			sort: "time"
		},
		success: function(data) {

			for(x in data.data) {
				var str = date2(data.data[x].time)
				profitDateArr.push("")
				profitArr.push({
					name: str,
					value: data.data[x].profit
				})

			}

			var myChart2 = echarts.init(document.getElementById('main2'));

			var option = {
				tooltip: {
					trigger: 'axis',
					formatter: function(params) {
						params = params[0];
						return params.data.name + "  " + params.data.value
					},
					axisPointer: {
						animation: false
					}
				},
				xAxis: {
					type: 'category',
					data: profitDateArr,
				},
				yAxis: {
					type: 'value',
					min: function(value) {

						return value.min - 100;
					},
					max: function(value) {
						return value.max + 100;
					}
				},
				series: [{
					data: profitArr,
					type: 'line',
					itemStyle: {
						normal: {
							lineStyle: {
								color: "#6eaaee"
							}
						}
					}

				}]
			};

			//			//			
			myChart2.setOption(option);

		}
	});

	//历史记录

	// 指定图表的配置项和数据

	// 使用刚指定的配置项和数据显示图表。
</script>